﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Practices.Prism.Regions;
using TimeSplicerModule.DomainModels;
using TimeSplicerModule.ViewModels;
using TimeSplicerModule.Factories;
using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.Unity;

namespace TimeSplicerModule.Views
{
    /// <summary>
    /// Interaction logic for PriorityListView.xaml
    /// </summary>
    public partial class PriorityListView : UserControl, INavigationAware
    {
        private PriorityListViewModel Model;
        private readonly IUnityContainer _cotntainer;
        private readonly IPriorityFactory _priorityFactory;

        public PriorityListView(IUnityContainer container, IPriorityFactory priorityFactory)
        {
            InitializeComponent();

            _cotntainer = container;
            _priorityFactory = priorityFactory;
        }

        public bool IsNavigationTarget(NavigationContext navigationContext)
        {
            return false; //throw new NotImplementedException();
        }

        public void OnNavigatedFrom(NavigationContext navigationContext)
        {
            //throw new NotImplementedException();
        }

        public void OnNavigatedTo(NavigationContext navigationContext)
        {
            Model = new PriorityListViewModel();
            Model.Priorities = _priorityFactory.GetList().ToList();

            this.DataContext = Model;
        }
    }
}
